package com.ruoyi.system.monitor;

import org.apache.commons.lang3.StringUtils;

public enum MonitorTypeEnum {

    MFO() {
        @Override
        public MonitorDataService getService() {
            return SpringContextUtil.getBean("mfoService");
        }
    },
    ZABBIX() {
        @Override
        public MonitorDataService getService() {
            return SpringContextUtil.getBean("zabbixService");
        }
    },
    PROMETHEUS {
        @Override
        public MonitorDataService getService() {
            return SpringContextUtil.getBean("prometheusService");
        }
    };

    public abstract MonitorDataService getService();

    public static MonitorTypeEnum getByName(String name) {
        MonitorTypeEnum[] values = MonitorTypeEnum.values();
        for (MonitorTypeEnum value : values) {
            if (StringUtils.equalsIgnoreCase(value.name(), name)) {
                return value;
            }
        }
        return null;
    }
}
